home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 008a / feb93cad.zip / TASKMAN.LSP < prev    next >
Lisp/Scheme  |  1993-02-12  |  4KB  |  116 lines

  1. ; **********************************************************
  2. ; TASKMAN.LSP
  3. ; Tasks Manager Program
  4. ; Copyright (c) Barry R. Bowen 1993
  5. ; ----------------------------------------------------------
  6. ; Variables:
  7. ; ANS    = Variable used for questions
  8. ; DCL_ID = Dialog box ID number
  9. ; DTE    = Variable for date section
  10. ; FILE   = TASKS.DCL file
  11. ; FILE1  = Specific task file for editing
  12. ; IN     = Index counter
  13. ; LBL    = Dialog box heading label
  14. ; LEN    = Length of string
  15. ; LINE   = Text string read/write to file
  16. ; NOTE   = String for note section of dialog box
  17. ; PRO    = String for priority section
  18. ; REM    = Remainder of string length
  19. ; TOG    = Toggle status
  20. ; ----------------------------------------------------------
  21.  
  22. (defun C:TASKMAN (/ ANS DCL_ID DTE FILE FILE1 IN LBL LEN
  23.                     LINE NOTE PRO REM TOG OLD_CMD OLD_ERROR)
  24.   (defun WLF (LINE) (write-line LINE FILE))
  25.   (setq OLD_CMD (getvar "cmdecho")
  26.         OLD_ERROR *error*
  27.         *error* ai_error
  28.   )
  29.   (setvar "cmdecho" 0)
  30.   (initget 1 "C T M R")
  31.   (setq ANS (getkword "\nCalls/Tasks/Master/Redick: "))
  32.   (cond
  33.     ((= ANS "C") (setq LBL "DAILY CALLS")
  34.                  (setq FILE1 "DCALLS.TSK"))
  35.     ((= ANS "T") (setq LBL "DAILY TASKS")
  36.                  (setq FILE1 "DTASKS.TSK"))
  37.     ((= ANS "M") (setq LBL "MASTER TASKS")
  38.                  (setq FILE1 "MTASKS.TSK"))
  39.     ((= ANS "R") (setq LBL "REDICHECK LIST")
  40.           (setq FILE1 (strcat (getvar "dwgname") ".TSK")))
  41.   )
  42.   (setq FILE (open "TASKS.DCL" "w"))
  43.   (WLF "TASKS : dialog {")
  44.   (WLF (strcat "label = " (chr 34) LBL (chr 34) ";"))
  45.   (WLF ": column {")
  46.   (setq IN 1)
  47.   (repeat 5
  48.     (WLF ": row {")
  49.     (WLF (strcat ":toggle {key = " (chr 34) "t"
  50.                    (itoa IN) (chr 34) ";}"))
  51.     (WLF (strcat ":edit_box {key = " (chr 34) "p"
  52.                    (itoa IN) (chr 34) ";
  53.                    edit_width = 2;}"))
  54.     (WLF (strcat ":edit_box {key = " (chr 34) "n"
  55.                    (itoa IN) (chr 34) ";
  56.                    edit_width = 45;}"))
  57.     (WLF (strcat ":edit_box {key = " (chr 34) "d"
  58.                    (itoa IN) (chr 34) ";
  59.                    edit_width = 8;}"))
  60.     (WLF "}")
  61.     (setq IN (1+ IN))
  62.   )
  63.   (WLF "} spacer_1; ok_cancel; }")
  64.   (close FILE)
  65.   (setq DCL_ID (load_dialog "TASKS"))
  66.   (new_dialog "TASKS" DCL_ID)
  67.   (if (/= (findfile FILE1) nil) (progn
  68.     (setq FILE (open FILE1 "r")
  69.           IN 1
  70.           LINE (read-line FILE))
  71.     (while LINE
  72.       (setq TOG (substr LINE 1 1))
  73.       (set_tile (strcat "t" (itoa IN)) TOG)
  74.       (set_tile (strcat "p" (itoa IN)) (substr LINE 2 2))
  75.       (set_tile (strcat "n" (itoa IN)) (substr LINE 4 45))
  76.       (set_tile (strcat "d" (itoa IN)) (substr LINE 49))
  77.       (setq IN (1+ IN)
  78.             LINE (read-line FILE))
  79.     )
  80.     (close FILE)
  81.   ))
  82.   (action_tile "accept" "(do_task)")
  83.   (action_tile "cancel" "(done_dialog)")
  84.   (start_dialog)
  85.   (setq *error* OLD_ERROR)
  86.   (setvar "cmdecho" OLD_CMD)
  87.   (unload_dialog DCL_ID)
  88.   (princ)
  89. )
  90.  
  91. (defun DO_TASK ()
  92.   (setq FILE (open FILE1 "w") IN 1)
  93.   (repeat 5
  94.    (setq TOG (get_tile (strcat "t" (itoa IN)))
  95.          PRO (get_tile (strcat "p" (itoa IN))))
  96.    (if (= PRO "") (setq PRO "  "))
  97.    (setq NOTE (get_tile (strcat "n" (itoa IN)))
  98.          DTE (get_tile (strcat "d" (itoa IN)))
  99.          LEN (strlen NOTE))
  100.    (if (< LEN 45)
  101.      (progn
  102.        (setq REM (- 45 LEN))
  103.        (repeat REM
  104.          (setq NOTE (strcat NOTE " "))
  105.    ) ) )
  106.    (WLF (strcat TOG PRO NOTE DTE))
  107.    (setq IN (1+ IN))
  108.   )
  109.   (close FILE)
  110.   (done_dialog dcl_id)
  111. )
  112.  
  113. (prompt "\nTaskManger Loaded..Type TASKMAN at Command prompt!")
  114. (princ)
  115.  
  116.